package com.ilancuo.enuum;

/**
 * 用法五：实现接口 所有的枚举都继承自java.lang.Enum类。由于Java 不支持多继承，所以枚举对象不能再继承其他类。
 * Created by ilancuo on 2018/4/8.
 */
public interface Behaviour {

    void printf();

    String getInfo();

    public enum Color implements Behaviour {
        RED("红色", 1), YELLOW("黄色", 2), WHITE("白色", 3), GREEN("绿色", 4);
        private String name;
        private int index;

        private Color(String name, int index) {
            this.name = name;
            this.index = index;
        }

        @Override
        public void printf() {
            System.out.println(this.index + ": " + this.name);
        }

        @Override
        public String getInfo() {
            return this.name;
        }
    }
}
